//
//  CataMiddleCell.m
//  ShangHaiTuJI
//
//  Created by xiaoxiangtuji on 2017/8/30.
//  Copyright © 2017年 xiaoxiangtuji. All rights reserved.
//

#import "CataMiddleCell.h"

@implementation CataMiddleCell

-(void)layoutSubviews{
    [self setSubviewsIn];
}

/**
 创建子视图布局
 */
-(void)setSubviewsIn{
    UIImageView *pictureView = [[UIImageView alloc] init];
    [self.contentView addSubview:pictureView];
    [pictureView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.equalTo(self.contentView);
        make.height.mas_equalTo(scaleTopAndBottom(170));
    }];
    UILabel *ageLabel = [[UILabel alloc] init];
    [self.contentView addSubview:ageLabel];
    [ageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(pictureView.mas_bottom).offset(scaleTopAndBottom(15));
        make.right.equalTo(self.contentView.mas_right);
        make.size.mas_equalTo(CGSizeMake(scaleLeftAndRight(80), scaleTopAndBottom(10)));
    }];
    UILabel *titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(pictureView.mas_bottom).offset(scaleTopAndBottom(5));
        make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(5));
        make.right.equalTo(ageLabel.mas_left);
        make.height.mas_equalTo(scaleTopAndBottom(20));
    }];
    UIImageView *iconView = [[UIImageView alloc] init];
    [self.contentView addSubview:iconView];
    [iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView);
        make.top.equalTo(titleLabel.mas_bottom).offset(scaleTopAndBottom(10));
        make.size.mas_equalTo(CGSizeMake(20, 20));
    }];
    UILabel *nameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(titleLabel.mas_bottom).offset(scaleTopAndBottom(15));
        make.left.equalTo(iconView.mas_right).offset(scaleLeftAndRight(5));
        make.height.mas_equalTo(scaleTopAndBottom(10));
        make.width.mas_equalTo(scaleLeftAndRight(100));
    }];
    UIImageView *watchView = [[UIImageView alloc] init];
    [self.contentView addSubview:watchView];
    [watchView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(nameLabel.mas_right);
        make.top.equalTo(titleLabel.mas_bottom).offset(scaleTopAndBottom(15));
        make.size.mas_equalTo(CGSizeMake(10, 10));
    }];
    UILabel *watchLabel = [[UILabel alloc] init];
    [self.contentView addSubview:watchLabel];
    [watchLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(titleLabel.mas_bottom).offset(scaleTopAndBottom(15));
        make.left.equalTo(watchView.mas_right).offset(scaleLeftAndRight(5));
        make.right.equalTo(self.contentView);
        make.height.mas_equalTo(scaleTopAndBottom(10));
    }];
    pictureView.backgroundColor = [UIColor greenColor];
    titleLabel.backgroundColor = [UIColor yellowColor];
   ageLabel.backgroundColor = [UIColor redColor];
    iconView.backgroundColor = [UIColor greenColor];
    nameLabel.backgroundColor = [UIColor purpleColor];
    watchView.backgroundColor = [UIColor orangeColor];
    watchLabel.backgroundColor = [UIColor cyanColor];
}

@end
